package com.ls.controller.invitetemplate;

import com.ls.controller.invitetemplate.model.AddInviteTemplateModel;
import com.ls.controller.invitetemplate.model.EditInviteTemplateModel;
import com.ls.controller.invitetemplate.model.UpdateStatusModel;
import com.ls.service.IInviteTemplateService;
import com.ls.utils.ResultData;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

/**
 * @ClassName InviteTemplateController
 * @Description 邀请函模板
 *
 * @author pengyu
 * @since 2024-06-28
 */
@Api(value = "邀请函模板", tags = "邀请函模板")
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/inviteTemplate")
public class InviteTemplateController {
    private final IInviteTemplateService service;
    /**新增*/
    @PostMapping("add")
    public ResultData add(@Valid @RequestBody AddInviteTemplateModel model) {
        return service.add(model);
    }
    /** 更新  */
    @PostMapping("edit")
    public ResultData edit(@Valid @RequestBody EditInviteTemplateModel model) {
        return service.edit(model);
    }
    /** 删除  */
    @PostMapping("del")
    public ResultData del(@RequestParam @NotNull(message = "id不得为空") Long inviteTemplateId) {
        return service.del(inviteTemplateId);
    }
    /**修改版本状态*/
    @PostMapping("updateStatus")
    public ResultData updateStatus(@Valid @RequestBody UpdateStatusModel model) {
        return service.updateStatus(model);
    }
    /**
     * 查询邀请函模板分页列表
     */
    @GetMapping("pageList")
    public ResultData pageList() {
        return service.pageList();
    }
}
